package com.mornd.gulimall.common.core.auth;

import com.mornd.gulimall.common.core.entity.SessionUser;

/**
 * @author: mornd
 * @dateTime: 2023/8/21 - 21:43
 * 登录用户
 */
public class UserHolder {
    private static final ThreadLocal<SessionUser> threadlocal = new ThreadLocal<>();

    public static SessionUser getUser() {
        return threadlocal.get();
    }

    public static void setUser(SessionUser sessionUser) {
        threadlocal.set(sessionUser);
    }

    public static void remove() {
        threadlocal.remove();
    }
}
